package logic;

import gamepieces.*;
import java.util.Vector;

public class Manager {
/*
 * Atributes
 */
	private Vector players;
	private int numPlayers;
	private int currentPlayer;
	private int lastPlayer;
	final static int MAX_PLAYERS = 6;
	
/*
 * Constructor
 */
	public Manager(){
		numPlayers = MAX_PLAYERS;
		newGame();
	}

	public Manager(int _numPlayers){
		numPlayers = _numPlayers;
		newGame();
	}
	
/*
 * Setters
 */
	
/*
 * Getters
 */

/*
 * Methods
 */
	public void newGame(){
		players = new Vector(numPlayers);
		for(int i = 0; i < numPlayers; i++){
			players.add(new Player("Jugador " + (i + 1), i));
		}
	}
	
	public void addPiece(int pieceId){
		Player p = (Player)players.get(currentPlayer);
		switch(pieceId){
			case 0:
				p.getCastle().add(new Armory());
				break;
			case 1:
				p.getCastle().add(new Cannon());
				break;
			case 2:
				p.getCastle().add(new Catapult());
				break;
			case 3:
				p.getCastle().add(new House());
				break;
			case 4:
				p.getCastle().add(new Interior());
				break;
		}
	}
}
